home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
ARGONET
/
PD
/
FILER
/
GZIP1_2_.SPK
/
Unixlib
/
c
/
memcmp
Wrap
Text File
|
1993-04-03
|
1KB
|
55 lines
#ifdef __STDC__
static char sccs_id[] = "@(#) memcmp.c 1.0 "__DATE__" HJR";
#else
static char sccs_id[] = "@(#) memcmp.c 1.0 26/9/90 HJR";
#endif
/* memcmp.c (c) Copyright 1990 H.Rogers */
#include <string.h>
#ifdef __STDC__
int memcmp(const void *s1,const void *s2,register size_t n)
#else
int memcmp(s1,s2,n)
const void *s1;
const void *s2;
register size_t n;
#endif
{
register unsigned char *_s1 = (unsigned char *)s1,*_s2 = (unsigned char *)s2;
while (n & 0x07)
{
n--;
if (*_s1 != *_s2) goto ret; _s1++,_s2++;
}
n >>= 3; while (n)
{
n--;
if (*_s1 != *_s2) goto ret; _s1++,_s2++;
if (*_s1 != *_s2) goto ret; _s1++,_s2++;
if (*_s1 != *_s2) goto ret; _s1++,_s2++;
if (*_s1 != *_s2) goto ret; _s1++,_s2++;
if (*_s1 != *_s2) goto ret; _s1++,_s2++;
if (*_s1 != *_s2) goto ret; _s1++,_s2++;
if (*_s1 != *_s2) goto ret; _s1++,_s2++;
if (*_s1 != *_s2) goto ret; _s1++,_s2++;
}
if (n == 0) return 0;
ret: return(*_s1 - *_s2);
}
#ifdef __STDC__
int (bcmp)(register const void *s1,register const void *s2,register size_t n)
#else
int (bcmp)(s1,s2,n)
register const void *s1;
register const void *s2;
register size_t n;
#endif
{
return(bcmp(s1,s2,n));
}